Skip to content

new logger with suppression functionality#79

Merged
ryukzak merged 32 commits intomainfrom
tagged-logging-handling
Mar 10, 2026
Merged

new logger with suppression functionality#79
ryukzak merged 32 commits intomainfrom
tagged-logging-handling

Conversation

@MikhailArtemyev
Copy link
Collaborator

@MikhailArtemyev MikhailArtemyev commented Feb 24, 2026

  • Replace codegen-logger.ts with a generic tagged logger (mkLogger<T>) supporting suppress-by-tag, deduplication, and buffered entries
  • Split into Log (read-only) and LogManager (with fork, buffer, printTagSummary)
    • fork() inherits parent prefix and suppressed tags; configure level/suppress only at creation
    • Remove setLevel(), suppress() runtime mutators — all config via mkLogger/fork options
  • Add CodegenTag union and typed aliases (CodegenLog, CodegenLogManager, mkCodegenLogger)
    • mkCodegenLogger always returns LogManager<CodegenTag> (no generic narrowing)
  • Reorganize utils: generic logger engine in common-log.ts, codegen-specific logging in log.ts, pure utility types in types.ts
  • Hide internal types (Log, LogEntry, LogManager, mkLogger) from package exports; expose only codegen-specific API
  • Replace shared module-level test loggers with per-test factory functions (mkErrorLogger(), mkSilentLogger(), mkTestLogger())
    • registerFsAndMkTs and resolveTs now require an explicit logger argument
  • Fork logger for register and typeschema stages, print tag summary before generators
  • Suppress #fieldTypeNotFound in R4 examples
  • Fix double-quote typo in duplicate schema warning, pass logger to enrichResolver

@ryukzak ryukzak force-pushed the tagged-logging-handling branch 5 times, most recently from 1847899 to d4e1445 Compare March 9, 2026 14:11
MikhailArtemyev and others added 22 commits March 10, 2026 16:17
replaced the old logger with the new one
Respects NO_COLOR, terminal detection, and piped output automatically.
Read from live suppressedSet instead of initial opts.suppressTags,
so tags added via .suppress() after construction are inherited by children.
Adds "silent" to LogLevel union. Existing tests using "SILENT" updated
to match the lowercase convention.
Log is the simple interface (warn, info, error, debug, dryWarn) used by
most consumers. LogManager extends Log with lifecycle features (fork, as,
suppress, setLevel, tagCounts, buffer).
…m generic Log

Centralizes all 7 log tags into a CodegenTag union in utils/types.ts so
passing an invalid tag string is now a type error. Replaces bare Log with
CodegenLog across typeschema, api, and writer-generator modules.
…tag summary

- Rename tags to hashtag camelCase (#binding, #fieldTypeNotFound, etc.)
- Move tag display to dimmed suffix: "message (#tag)" instead of "#tag message"
- Use "/" separator for forked prefixes: api/reg, api/ts
- Replace printSuppressedSummary with printTagSummary that reports both
  emitted and suppressed tag counts separately
- Add fork() overload to preserve parent tag type with suppressTags
ryukzak and others added 10 commits March 10, 2026 16:17
… utils/log.ts

Move generic logger engine to common-log.ts and codegen-specific logging
(CodegenTag, CodegenLog, CodegenLogManager, mkCodegenLogger) from
utils/types.ts into utils/log.ts. utils/types.ts now only contains
generic utility types.
- Replace module-level errorLogger/silentLogger with mkErrorLogger()/mkSilentLogger() factories
- Make logger a required param in registerFsAndMkTs and resolveTs
- Each test describe block now creates its own logger via mkTestLogger()
@ryukzak ryukzak force-pushed the tagged-logging-handling branch from 6dced77 to 096d0c9 Compare March 10, 2026 15:17
@ryukzak ryukzak merged commit cafd958 into main Mar 10, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants